home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 008a / perl40_2.zip / HASH.H < prev    next >
C/C++ Source or Header  |  1991-11-28  |  2KB  |  79 lines

  1. /* $RCSfile: hash.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 17:24:31 $
  2.  *
  3.  *    Copyright (c) 1991, Larry Wall
  4.  *
  5.  *    You may distribute under the terms of either the GNU General Public
  6.  *    License or the Artistic License, as specified in the README file.
  7.  *
  8.  * $Log:    hash.h,v $
  9.  * Revision 4.0.1.2  91/11/05  17:24:31  lwall
  10.  * patch11: random cleanup
  11.  *
  12.  * Revision 4.0.1.1  91/06/07  11:10:33  lwall
  13.  * patch4: new copyright notice
  14.  *
  15.  * Revision 4.0  91/03/20  01:22:38  lwall
  16.  * 4.0 baseline.
  17.  *
  18.  */
  19.  
  20.  
  21. #define FILLPCT 80        /* don't make greater than 99 */
  22. #define DBM_CACHE_MAX 63    /* cache 64 entries for dbm file */
  23.                 /* (resident array acts as a write-thru cache)*/
  24.  
  25.  
  26. #define COEFFSIZE (16 * 8)    /* size of coeff array */
  27.  
  28.  
  29. typedef struct hentry HENT;
  30.  
  31.  
  32. struct hentry {
  33.     HENT    *hent_next;
  34.     char    *hent_key;
  35.     STR        *hent_val;
  36.     int        hent_hash;
  37.     int        hent_klen;
  38. };
  39.  
  40.  
  41. struct htbl {
  42.     HENT    **tbl_array;
  43.     int        tbl_max;    /* subscript of last element of tbl_array */
  44.     int        tbl_dosplit;    /* how full to get before splitting */
  45.     int        tbl_fill;    /* how full tbl_array currently is */
  46.     int        tbl_riter;    /* current root of iterator */
  47.     HENT    *tbl_eiter;    /* current entry of iterator */
  48.     SPAT     *tbl_spatroot;    /* list of spats for this package */
  49.     char    *tbl_name;    /* name, if a symbol table */
  50. #ifdef SOME_DBM
  51. #ifdef HAS_GDBM
  52.     GDBM_FILE    tbl_dbm;
  53. #else
  54. #ifdef HAS_NDBM
  55.     DBM        *tbl_dbm;
  56. #else
  57.     int        tbl_dbm;
  58. #endif
  59. #endif
  60. #endif
  61.     unsigned char tbl_coeffsize;    /* is 0 for symbol tables */
  62. };
  63.  
  64.  
  65. STR *hfetch();
  66. bool hstore();
  67. STR *hdelete();
  68. HASH *hnew();
  69. void hclear();
  70. void hentfree();
  71. void hfree();
  72. int hiterinit();
  73. HENT *hiternext();
  74. char *hiterkey();
  75. STR *hiterval();
  76. bool hdbmopen();
  77. void hdbmclose();
  78. bool hdbmstore();
  79.